package org.example.myleet.p497;

import org.example.myleet.Utils.JsonUtils;
import org.example.myleet.Utils.Parser;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
//        Solution solution = new Solution(Parser.parse("[[0, 0, 1, 1], [2, 2, 3, 3], [4, 4, 5, 5]]"));
//        Solution solution = new Solution(Parser.parse("[[-2, -2, 1, 1], [2, 2, 4, 6]]"));
        Solution solution = new Solution(Parser.parse("[[82918473,-57180867,82918476,-57180863],[83793579,18088559,83793580,18088560],[66574245,26243152,66574246,26243153],[72983930,11921716,72983934,11921720]]"));
        Map<String, Integer> countMap = new HashMap<>();
        for (int i = 0; i < 100000; ++i) {
            int[] p = solution.pick();
            String key = String.format("%d_%d", p[0], p[1]);
            countMap.put(key, countMap.getOrDefault(key, 0) + 1);
        }
        System.out.println(countMap);
        System.out.println((Integer) countMap.values().stream().mapToInt(v -> v).sum());
    }
}
